package org.career.pdung.serviceImpl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.career.pdung.DAOImpl.PersonDAOImpl;
import org.career.pdung.domain.Person;
import org.career.pdung.service.PersonService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * phandung
 * 
 */
@SuppressWarnings("restriction")
@Service("personServiceImpl")
@Transactional
public class PersonServiceImpl implements PersonService {

	protected static Logger logger = Logger.getLogger("service");
	
	@Resource(name="personDAOImpl")
	private PersonDAOImpl personDAOImpl;
	
	public List<Person> getAll() {
		logger.debug("Retrieving all persons");
		return  personDAOImpl.getAll();
	}
	
	public Person get( Integer id ) {
		logger.debug("Retrieving  person id");
		return personDAOImpl.get(id);
	}

	public void add(Person person) {
		logger.debug("Adding new person");		
		personDAOImpl.add(person);
	}
	
	public void delete(Integer id) {
		logger.debug("Deleting existing person");
		personDAOImpl.delete(id);
	}
	
	public void edit(Person person) {
		logger.debug("Editing existing person");
		personDAOImpl.edit(person);
	}
}
